package org.wzy.design.patterns.proxy.jdk;

import java.io.FileOutputStream;

import sun.misc.ProxyGenerator;

/** 
 * ClassName: TestFindLover <br/> 
 * Function: TODO ADD FUNCTION. <br/> 
 * Reason: TODO ADD REASON(可选). <br/> 
 * date: 2017年6月14日 下午11:24:11 <br/> 
 * 
 * @author wzy_h 
 * @version  
 * @since JDK 1.8
 */
public class TestFindLover {
	public static void main(String[] args) {
//		new XiaoXingXing().findLover();
		
		try {
			Person p = (Person) new Meipo().getInstance(new XiaoXingXing());
//			p.findLover();
			
			byte[] data = ProxyGenerator.generateProxyClass("$Proxy0", new Class[] {p.getClass()});
			FileOutputStream os = new FileOutputStream("$Proxy0.class");
			os.write(data);
			os.close();
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
}
